package cn.itcast.controller;

import cn.itcast.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("login")
public class LoginController {

    public void login(String username, String password, HttpSession session){
        System.out.println("进入登录操作");
        //通过查询user
        User user = new User();
        user.setUsername("lidngkui");
        user.setAddress("北京");
        if(user!=null){
            //登录成功  将user存储到session
            session.setAttribute("user",user);
            System.out.println("登录成功");
        }
        System.out.println("登录失败");
    }
}
